Locates and opens a graphics importer component that can be used to draw the specified data reference.
pascal OSErr GetGraphicsImporterForDataRef(
Handle dataRef,
OSType dataRefType,
ComponentInstance *gi);
GetGraphicsImporterForDataRef tries to locate a graphics importer component for the specified data reference by checking the file name extension of the file, the file type information, and the MIME type of the file. The file name extension is retrieved from the data reference by use of the DataHGetFileName call to the data handler associated with the data reference.
If it is unable to locate a graphics importer for the file, the returned ComponentInstance is set to nil . If it is able to locate a graphics importer for the data reference, the returned graphics importer ComponentInstance will have already been set up to draw the specified data reference in the current port.
The caller of GetGraphicsImporterForDataRef is responsible for closing the returned ComponentInstance using CloseComponent .
Locates and opens a graphics importer component that can be used to draw the specified file.
pascal OSErr GetGraphicsImporterForFile(
const FSSpec *theFile,
ComponentInstance *gi);
GetGraphicsImporterForFile first tries to locate a graphics importer component for the specified file based on the Macintosh file type of the file. If it is unable to locate a graphics importer component based on the Macintosh file type, and the file type is 'TEXT' , GetGraphicsImporterForFile will try to locate a graphics importer component for the specified file based on the file name extension of the file.
If it is unable to locate a graphics importer for the file, the returned ComponentInstance is set to nil . If it is able to locate a graphics importer for the file, the returned graphics importer ComponentInstance will have already been set up to draw the specified file in the current port.
The caller of GetGraphicsImporterForFile is responsible for closing the returned ComponentInstance using CloseComponent .
| Previous | Chapter Contents | Chapter Top |